#pragma once
#include "../../Struct.h"
namespace ssqk {

class Util {
public:
	// lines
	static void toKuantiData(CVector<::LineArg>& outData, const CVector<sq::LineArg>& inData) {
		for (const auto& arg : inData) {
			LineArg line;
			line.tag = arg.tag;
			line.eq = arg.eq;
			line.style = arg.style;
			line.color = arg.color;
			outData << line;
		}
	}

	// models
	static void toKuantiData(CVector<::ModelArg>& outData, const CVector<sq::ModelArg>& inData) {
		for (const auto& arg : inData) {
			ModelArg model;
			model.ID = arg.id;
			model.type = arg.type;
			model.pos = arg.pos;
			model.angle = arg.angle;// already turned to radians
			model.recog = arg.recog;
			outData << model;
		}
	}

	/******************************** Raw Line ************************************************/
	static LineStyle lineStyle(int type) {
		switch(type) {
			case 1: return LineStyle::Solid;
			case 2: return LineStyle::Dashed;
			case 3: return LineStyle::Double_Solid;
			case 4: return LineStyle::Solid_Dashed;
			case 5: return LineStyle::Dashed_Solid;
			case 6: return LineStyle::Double_Dashed;
		}
		return LineStyle::INVALID;
	}

	static CColor lineColor(int colour) {
		switch(colour) {
			case 1: return "white";
			case 2: return "yellow";
		}
		CColor invalid;
		return invalid;
	}

	/******************************** Raw Model ************************************************/
	static ModelType modelType(int objClass) {
		switch (objClass) {
			case 1: return ModelType::Car;
			case 2: return ModelType::Person;
			case 3: return ModelType::Moto;
			case 4: return ModelType::Bus;
			case 5: return ModelType::Truck;
			case 6: return ModelType::Tricycle;
		}
		return ModelType::INVALID;
	}

	static int modelTypeValue(ModelType type) {
		switch (type) {
			case ModelType::Car: return 1;
			case ModelType::Person: return 2;
			case ModelType::Moto: return 3;
			case ModelType::Bus: return 4;
			case ModelType::Truck: return 5;
			case ModelType::Tricycle: return 6;
		}
		return -1;
	}

	static P modelPos(float hDist, float vDist) {// left-positive(-X), front-positive(-Z)
		return P(-hDist, -vDist);
	}
};

};// end namespace